package com.smart.web.controller.user.watches;

import com.smart.common.core.domain.R;
import com.smart.system.domain.dto.CommandRequest;
import com.smart.system.domain.dto.DeviceSettingsDto;
import com.smart.system.service.IWatchesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/watches/send")
@Api(tags = "手表数据下行")
public class SendWatchesController {

    @Autowired
    private IWatchesService watchesService;

    /**
     * 下发语音(不支持)
     * @param req
     * @return
     */
    @ApiOperation(value = "下发语音(不支持)")
    @PostMapping("/sendAudio")
    public R send(@RequestBody CommandRequest req) {
        watchesService.sendInstruct(req);
        return R.ok();
    }


    /**
     * 下发SOS号码
     * @param imei
     * @param sos1
     * @param sos2
     * @param sos3
     * @return
     */
    @ApiOperation(value = "下发紧急联系人")
    @PostMapping("/setSos")
    public R setSos(String imei, String sos1,String sos2, String sos3) {
        return R.ok(watchesService.setSos(imei,sos1,sos2,sos3));
    }

    @ApiOperation(value = "下发设备参数")
    @PostMapping("/setDevice")
    public R setDevice(@RequestBody DeviceSettingsDto dto) {
        return R.ok(watchesService.setDevice(dto));
    }

}
